var closetop = document.querySelector(".topClose");
var toptop = document.querySelector(".top");
closetop.onclick = function() {
  toptop.style.display = "none";
};
var navbtn = document.querySelector(".nav-display");
var Arrow = document.querySelector(".icon-jiantou");
var navlist = document.querySelector(".nav-item-list");
var headernav = document.querySelector(".header-nav");
var count = 0;
navbtn.onclick = function() {
  count++;
  if (count % 2) {
    Arrow.classList.add("open");
    navlist.style.display = "block";
    headernav.style.display = "none";
  } else {
    Arrow.classList.remove("open");
    navlist.style.display = "none";
    headernav.style.display = "block";
  }
};
//轮播图
var ul = document.querySelector(".banner-wrap");
var lis = document.querySelectorAll(".banner-item");
var dots = document.querySelectorAll(".dot");
var index = 0;
var lastindex = index;

function showimg() {
  dots[lastindex].className = "";
  ul.style.left = -lis[0].offsetWidth * index + "px";
  dots[index].className = "dot-active";
  lastindex = index;
}
function nextimg() {
  index = index == lis.length - 1 ? 0 : index + 1;
  showimg();
}
var timer = setInterval(nextimg, 3000);

// 回到顶部
var backtop=document.querySelector('.back')
window.onscroll = function(){
    
    if(document.scrollingElement.scrollTop > 1040){
        backtop.style.display = 'block';
    }else{
        backtop.style.display = 'none';
    }
}